import { fetchList, submitApprove } from '@/api/approve/index'

const state = {
  list: []
}

const mutations = {
  SET_APPROVELIST: (state, args) => {
    state.list = args
  }
}

const actions = {
  setApproveList({ commit }, args) {
    return fetchList(args).then(response => {
      console.log('approve', response)

      commit('SET_APPROVELIST', response.data)
    })
  },
  submitApproveInfo({ commit }, args) {
    return submitApprove(args)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
